import { DocInfo } from "@/types";
import { useCallback } from "react";
import { useDispatch, useSelector } from "react-redux";
import { setDocInfoAction } from "../action";
import { getStateDoc } from "../getter";

export const useStateDocInfo = () => useSelector(getStateDoc)

export function useDispatchDoc() {
  const dispatch = useDispatch()
  const stateSetDoc = useCallback((info: DocInfo) => dispatch(setDocInfoAction(info)), [dispatch])
  return { stateSetDoc }
}